﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace TestForm
{
	public partial class MainForm : Form
	{
		public MainForm()
		{
			InitializeComponent();
		}

		private void OnButtonConnectDisconnectClick(object sender,EventArgs e)
		{
			if (this.rdpControl.Connected > 0)
				this.rdpControl.Disconnect();
			else
			{
				this.rdpControl.Server = this.textBoxServerAddress.Text;
				this.rdpControl.Connect();
			}

			this.buttonConnectDisconnect.Enabled = false;
		}

		private void OnRDPControlDisconnected(object sender,AxMSTSCLib.IMsTscAxEvents_OnDisconnectedEvent e)
		{
			this.buttonConnectDisconnect.Text = "Connect";
			this.buttonConnectDisconnect.Enabled = true;
		}

		private void OnRDPControlConnected(object sender,EventArgs e)
		{
			this.buttonConnectDisconnect.Text = "Disconnect";
			this.buttonConnectDisconnect.Enabled = true;
		}
	}
}
